<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::post('goods/{id}', 'AdminController@getGoods');
Route::post('admin', 'AdminController@index');

Route::middleware(['auth:api'])->group(function () {
    Route::group(    [
        'namespace' => 'Admin',
        'prefix' => 'admin'
    ], function ($router) {
        Route::get('export','ExcelController@export');
        Route::post('import','ExcelController@import');
        Route::post('data/index','DataController@index');
        //用户相关
        Route::post('member/index','MemberController@index');
        Route::post('member/import','MemberController@import');
        Route::get('member/export','MemberController@export');
        Route::get('member/exportToday','MemberController@exportToday');
        Route::post('member/destroy/{id}','MemberController@destroy');
        Route::get('member/exportMemberAnswer/{id}','MemberController@exportMemberAnswer');


        
        //打卡记录配置列表
        Route::post('clock/index','ClockController@index');
        Route::post('clock/update/{id}','ClockController@update');
        Route::post('clock/enable/{id}','ClockController@enable');

        //打卡记录列表
        Route::post('record/index','ClockController@recordIndex');


        //问题列表
        Route::post('problem/index','ProblemController@index');
        Route::post('problem/audit/{id}','ProblemController@audit');
        Route::get('problem/export','ProblemController@export');
        Route::post('problem/import','ProblemController@import');

        Route::post('config/update/{id}','MemberController@updateConfig');
        Route::post('subject/getOrganizationList','SubjectController@getOrganizationList');


        Route::post('problem/getAnswerByProblem/{id}','ProblemController@getAnswerByProblem');
        Route::post('problem/getProblem','ProblemController@getProblem');
        Route::post('problem/updateProblemInfo/{id}','ProblemController@updateProblemInfo');
        Route::post('problem/updateAnswerInfo/{id}','ProblemController@updateAnswerInfo');
        //医院

        Route::post('hospital/hosAdd','HospitalController@hosAdd');
        Route::post('hospital/destroy/{id}','HospitalController@destroy');
        Route::post('hospital/update/{id}','HospitalController@update');
        Route::post('hospital/createTag/{id}','HospitalController@createTag');

    });

});


Route::group(    [
    'namespace' => 'Admin',
    'prefix' => 'admin'
], function ($router) {
    //data相关
    Route::post('data/statistics','DataController@statistics');
    Route::post('data/select','DataController@select');
    Route::post('data/getAccessToken','DataController@getAccessToken');
    Route::post('data/add','DataController@create');
    Route::post('data/info','DataController@getInfo');


    //notice相关模块

    Route::post('notice/noticeAdd','NoticeController@create');
    Route::post('notice/destroy/{id}','NoticeController@destroy');
    Route::post('notice/update/{id}','NoticeController@update');
    Route::post('notice/index','NoticeController@index');

    //题库相关模块

    Route::post('subject/noticeAdd','SubjectController@create');
    Route::post('subject/destroy/{id}','SubjectController@destroy');
    Route::post('subject/update/{id}','SubjectController@update');
    Route::post('subject/list/{id}','SubjectController@index');


    //部门绑定题库模块
    Route::post('subject/addOrganizationSubject','SubjectController@addOrganizationSubject');
    Route::post('subject/organizationSubjectList','SubjectController@organizationSubjectList');
    Route::post('subject/organizationSubjectSumList','SubjectController@organizationSubjectSumList');
    Route::post('subject/updateOrganizationSubjectSum','SubjectController@updateOrganizationSubjectSum');
    Route::get('subject/exportSubject/{id}','SubjectController@exportSubject');

    Route::post('subject/getSubjectQuestion/{id}','ProblemController@getSubjectQuestion');
    Route::post('subject/getOrganizationSubject/{id}','ProblemController@getOrganizationSubject');
    Route::post('problem/getConfig','ProblemController@getConfig');
    Route::post('config/index','MemberController@indexConfig');


    //member--H5 登录
    Route::post('member/getInfo','MemberController@login');
    Route::post('member/update/{id}','MemberController@update');
    Route::post('member/memberAdd','MemberController@memberAdd');
    Route::post('member/MemberInfo/{id}','MemberController@MemberInfo');
    Route::post('member/rank/{id}','MemberController@rank');
    Route::post('member/receive/{id}','MemberController@receive');
    Route::post('member/achievementList','MemberController@achievementList');
    Route::post('member/achieveDay/{id}','MemberController@achieveDay');
    Route::post('member/updateMemberLast/{id}','MemberController@updateMemberLast');
    Route::post('member/getMemberInfo','MemberController@getMemberInfo');
    Route::post('url/index','MemberController@indexUrl');
    Route::post('url/update/{id}','MemberController@updateUrl');


    //年会项目
    Route::post('clock/clock/{id}','ClockController@clock');
    Route::post('clock/onIndex','ClockController@onIndex');
    //数据模块相关
    Route::get('record/export','ClockController@export');


    //问题列表
    Route::post('problem/create','ProblemController@create');
    Route::post('problem/audit/{id}','ProblemController@audit');
    Route::post('problem/onIndex','ProblemController@onIndex');
    Route::post('problem/destroy/{id}','ProblemController@destroy');
    Route::post('problem/answerFinish/{id}','ProblemController@answerFinish');
    Route::post('problem/problemCheck/{id}','ProblemController@problemCheck');
    Route::post('problem/memberAnswer/{id}','ProblemController@memberAnswer');
    Route::post('problem/memberProblemIndex/{id}','ProblemController@memberProblemIndex');//答题人获取题目api
    Route::post('member/getMemberHaveAnswer/{id}','MemberController@getMemberHaveAnswer');//答题人获取题目api


    //医院
    Route::post('hospital/index','HospitalController@index');
    Route::post('hospital/vote/{id}','HospitalController@vote');




    //城市api
    Route::post('city/index','CityController@index');
    
    
    //弹幕项目api
    Route::post('prefix/update','DataController@prefixUpdate');
    Route::post('prefix/prefixIndex','DataController@prefixIndex');
    Route::post('prefix/addContent','DataController@addContent');
    Route::post('prefix/appAddContent','DataController@appAddContent');
    Route::post('prefix/contentList','DataController@contentList');
    Route::post('prefix/deleteAll','DataController@deleteAll');
    Route::post('prefix/deleteOne/{id}','DataController@deleteOne');
    Route::get('prefix/export','DataController@exportPrefix');


    
});






/**
 * 后台路由
 */

/**后台模块**/
Route::group(['namespace' => 'Admin','prefix' => 'admin'], function (){
    /**需要登录认证模块**/
    Route::middleware(['auth:admin','rbac'])->group(function (){

        Route::resource('index', 'IndexsController', ['only' => ['index']]);  //首页

        Route::get('index/main', 'IndexsController@main')->name('index.main'); //首页数据分析

        Route::get('admins/status/{statis}/{admin}','AdminsController@status')->name('admins.status');

        Route::get('admins/delete/{admin}','AdminsController@delete')->name('admins.delete');

        Route::resource('admins','AdminsController',['only' => ['index', 'create', 'store', 'update', 'edit']]); //管理员

        Route::get('roles/access/{role}','RolesController@access')->name('roles.access');

        Route::post('roles/group-access/{role}','RolesController@groupAccess')->name('roles.group-access');

        Route::resource('roles','RolesController',['only'=>['index','create','store','update','edit','destroy'] ]);  //角色

        Route::get('rules/status/{status}/{rules}','RulesController@status')->name('rules.status');

        Route::resource('rules','RulesController',['only'=> ['index','create','store','update','edit','destroy'] ]);  //权限

        Route::resource('actions','ActionLogsController',['only'=> ['index','destroy'] ]);  //日志
    });
});


